﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ModemWrite
{
    public class PublicData
    {
        public static Dictionary<string, int> ListAddress = new Dictionary<string, int>();

        public static readonly object LOCKOBJUI = new object();

        //重新扫入BOSA/MAC的委托
        public static EnterMsgDelegate enterMsgDelegate = delegate (int formNum, string promptMsg)
        {
            string msg = null;
            while (true)
            {

                //重新扫描BOSA
                FormMessageReturn retMsg = new FormMessageReturn();
                FromEnter enter = new FromEnter(string.Format("请扫入窗口[{0}]的{1}", formNum, promptMsg), retMsg);
                enter.ShowDialog();

                FormMessageReturn retMsg2 = new FormMessageReturn();
                enter = new FromEnter(string.Format("请再次扫入窗口[{0}]的{1}", formNum, promptMsg), retMsg2);
                enter.ShowDialog();

                if (retMsg.Msg != retMsg2.Msg)
                {
                    MessageBox.Show(string.Format("扫入的{0}不一致，重新扫描", promptMsg));
                    continue;
                }
                else
                {
                    msg = retMsg.Msg;
                    break;
                }
            }
            return msg;
        };
    }

    public class FormMessageReturn
    {
        public string Msg { get; set; }
    }

    public delegate string EnterMsgDelegate(int fromNum,string promptMsg);//委托


    /// <summary>
    /// 存储信息检查的组合
    /// </summary>
    public class WriteGroup
    {
        public string LocalIp { get; set; }
        public int LocalPort { get; set; }
        public FormRealWrite RealWrite { get; set; }
    }

    public class WriteGroupScan
    {
        public string LocalIp { get; set; }
        public int LocalPort { get; set; }
        public FormRealWriteScan RealWrite { get; set; }
    }


    //存储重置光猫的组合
    public class ResetGroup
    {
        public string LocalIp { get; set; }
        public int LocalPort { get; set; }
        public FormFactoryCheck resetModem { get; set; }
    }

    //存储出厂检查的组合
    public class MsgCheckGroup
    {
        public string LocalIp { get; set; }
        public int LocalPort { get; set; }
        public FormMsgCheck msgCheck { get; set; }
    }
    //语音测试集合
    public class VoiceTestGroup
    {
        public string LocalIp { get; set; }
        public int LocalPort { get; set; }
        public FormRealTest voiceTest { get; set; }
    }

    //融合测试集合
    public class TestTwoGroup
    {
        public string LocalIp { get; set; }
        public int LocalPort { get; set; }
        public FormTwo twoTest { get; set; }
    }

}
